package com.example.rwq_test.ThreadPool;

import lombok.Data;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

/**
 * TODO note
 *
 * @author renweiqiang
 * @version 1.0.0
 * @createTime 2023/1/9
 */
@Data
public class Task implements Callable<Task> {
    private Integer num;
    private Integer age;

    public Task(Integer num){
        this.num = num;
        this.age = 3;
    }

    public Integer getNum() {
        return num;
    }

    public Integer getAge() {
        return age;
    }

    @Override
    public Task call() {
        try {
            TimeUnit.MILLISECONDS.sleep(50);
            int a = num / 0;
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("do something:"+num +"   Thread:"+Thread.currentThread());
        return this;
    }
}
